<?php
/**
 * Created by PhpStorm.
 * User: iceberg
 * Date: 2018-10-05
 * Time: 22:35
 */

namespace app\base\controller;


use app\service\SupplierService;
use think\Controller;
use think\facade\Request;

class Supplier extends Controller
{
    //供应商业务
    private $supplierService;
    //初始化方法
    public function initialize()
    {
        $this->supplierService = new SupplierService();
    }

    //列表
    public function index()
    {
        $this->assign('list', $this->supplierService->page());
        $this->assign('count', $this->supplierService->count());
        return $this->fetch();
    }

    //显示创建页面
    public function create()
    {
        return $this->fetch();
    }

    //添加保存
    public function save()
    {
        return $this->supplierService->save();
    }

    //显示编辑界面
    public function edit($id)
    {
        $this->assign('info', $this->supplierService->edit($id));
        return $this->fetch();
    }

    //更新
    public function update()
    {
        return $this->supplierService->update();
    }

    //删除
    public function delete($id)
    {
        return $this->supplierService->delete($id);
    }

}